* create event study graph, normalize beta_-1 to zero
gen b_ES_`2'=.
gen se_ES_`2'=.
forvalues i=1/5 {
local index = 6 - `i' 	
replace b_ES_`2' = - _b[devaf1] +  _b[devaf`index'] if _n == `i' // normalizing to beta_-1 to zero
replace se_ES_`2' = _se[devaf`index'] if _n == `i'
}
replace b_ES_`2'= -_b[devaf1] + _b[app] if _n==6
replace se_ES_`2' = _se[app] if _n == 6

forvalues i=1/5{
local index = 6 + `i' 
replace b_ES_`2' = -_b[devaf1] + _b[deval`i'] if _n == `index'
replace se_ES_`2' = _se[deval`i'] if _n == `index'
}

gen up_ES_`2' = b_ES_`2' + invt(`e(df_r)',1-`1'/2)*se_ES_`2' if _n <= 11
gen dn_ES_`2' = b_ES_`2' - invt(`e(df_r)',1-`1'/2)*se_ES_`2' if _n <= 11

twoway (line up_ES_`2' Years, ///
xlabel(-5(1)5) fcolor(gs12) lcolor(`3') lpattern(dash) lwidth(thin)) ///
(line dn_ES_`2' Years, ///
xlabel(-5(1)5) fcolor(gs12) lcolor(`3') lpattern(dash) lwidth(thin)) ///
(line b_ES_`2' Years, lcolor(`3') ///
lpattern(solid) lwidth(thick)), /// 	
ytitle("Percent", size(medsmall)) xtitle("Year", size(medsmall)) ///
graphregion(color(white)) plotregion(color(white)) ///
legend(off) name(ES1, replace)
